home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr49
/
actlib11.zip
/
STRINGS.ZIP
/
NCOMP.C
< prev
next >
Wrap
Text File
|
1993-01-14
|
838b
|
33 lines
/* Copyright (C) 1993 Marc Stern (internet: stern@mble.philips.be) */
#include "strings.h"
/***
* Function : strncomp
*
* Description : Compare n characters of two strings case-insensitive
* All special characters are translated (éèà...)
*
* Parameters : in char *str1
* in char *str2
*
* Return : -1 if str1 < str2
* 1 if str1 > str2
* 0 if str1 == str2
*
* OS/Compiler : All
***/
int strncomp( const char *str1, const char *str2, int length )
{
for (; length && *str1 && *str2; length --, str1++, str2++ )
if ( chcase(*str1, 1) != chcase(*str2, 1) ) break;
if ( ! length ) return 0;
if ( chcase(*str1, 1) < chcase(*str2, 1) ) return -1;
if ( chcase(*str1, 1) > chcase(*str2, 1) ) return 1;
return 0;
}